
/******************************************************************************\
|    Title:        	 Table E5: Intraclass Correlation Coefficients for Staffer |
						Random Intercepts on Annual Salary					   |
|    Date:         	 July 2023	                                         	   |
|    Author:         Elisa Wirsching	      							       |
\******************************************************************************/

clear all
set more off, permanently
numlabel, add
set maxvar 32000

use congress_yearly.dta, clear

mixed adjannual_pay || stafferid: if posttreat==1 & max_rank==1
estat icc
scalar icc21 = r(icc2) 
scalar seicc1 = r(se2) 

mixed adjannual_pay || stafferid: if posttreat==1 & max_rank==2
estat icc
scalar icc22 = r(icc2) 
scalar seicc2 = r(se2)

mixed adjannual_pay || stafferid: if posttreat==1 & max_rank==3
estat icc
scalar icc23 = r(icc2)
scalar seicc3 = r(se2) 

mixed adjannual_pay || stafferid: if posttreat==1 & max_rank==4
estat icc
scalar icc24 = r(icc2)
scalar seicc4 = r(se2) 

mixed adjannual_pay || stafferid: if posttreat==1 & max_rank==5
estat icc
scalar icc25 = r(icc2)
scalar seicc5 = r(se2) 

mixed adjannual_pay || stafferid: if posttreat==1 & max_rank==6
estat icc
scalar icc26 = r(icc2)
scalar seicc6 = r(se2) 

mixed adjannual_pay || stafferid: if posttreat==1 & max_rank==7
estat icc
scalar icc27 = r(icc2)
scalar seicc7 = r(se2) 

mixed adjannual_pay || stafferid: if posttreat==1 & max_rank==8
estat icc
scalar icc28 = r(icc2)
scalar seicc8 = r(se2) 


matrix RESULTS = (icc21 , seicc1 \ icc22, seicc2 \ icc23, seicc3 \ icc24, seicc4 \ icc25, seicc5 \ icc26, seicc6 \ icc27, seicc7 \ icc28, seicc8)

putexcel set TABLED5, replace
putexcel A1="Rank"
putexcel A2="Rank 1"
putexcel A3="Rank 2"
putexcel A4="Rank 3"
putexcel A5="Rank 4"
putexcel A6="Rank 5"
putexcel A7="Rank 6"
putexcel A8="Rank 7"
putexcel A9="Rank 8"
putexcel B1="Title Group"
putexcel B2="Chief of Staff"
putexcel B3="Deputy Chief of Staff"
putexcel B4="State/District Director"
putexcel B5="Legislative Director"
putexcel B6="Communications Director"
putexcel B7="Legislative Assistant"
putexcel B8="Legislative Correspondent/ Deputy Press Secretary/Specials Director/ Deputy State/District Director"
putexcel B9="Executive Assistant/ Office Manager/Caseworker/ Staff Assistant"

putexcel C1="ICC estimate"
putexcel D1="ICC standard error"
putexcel C2=matrix(RESULTS)

* NOTE (July 2023): a prior version of the manuscript had a mistake in the standard error of the ICC of rank 1 (corrected in final version following conditional acceptance)



